<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/include/taglib.jsp" %>
<html>
<head>
    <title>校务通知表</title>
    <%@ include file="../../include/head.jsp" %>
    <link href="${ctxStatic}/custom/css/amazeui.select.css" type="text/css" rel="stylesheet" charset="UTF-8"/>
    <style>
        .tpl-content-wrapper {
            margin-left: 0
        }
    </style>
</head>
<body>
<script src="${ctxStatic}/assets/js/theme.js"></script>
<div class="am-g tpl-g">
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-3 am-u-lg-3">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">通知管理菜单</div>
                        </div>
                        <div class="widget-body widget-body-lg am-fr">
                            <div class="am-scrollable-horizontal">
                                <ul id="tree" class="ztree">
                                    <li><a href="${ctx}/edu/circular/list">通知记录</a></li>
                                    <li><a href="${ctx}/edu/circular/create">新建通知</a></li>
                                    <li><a href="${ctx}/edu/circular/list">收件箱</a></li>
                                </ul><!-- 组织机构列表 -->
                            </div>
                        </div>
                    </div>
                </div>
                <div class="am-u-sm-12 am-u-md-9 am-u-lg-9">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">新建通知</div>
                        </div>
                        <div class="widget-body am-fr">
                            <form class="am-form tpl-form-border-form" data-am-validator modelAttribute="circular"
                                  action="${ctx}/edu/circular/<c:choose><c:when test="${empty circular.id}">create</c:when><c:otherwise>update</c:otherwise></c:choose>"
                                  method="post"
                                  enctype="multipart/form-data">
                                <input type="hidden" name="id" value="${circular.id}"/>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">收件人：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="receivers" placeholder="收件人"
                                               required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">通知标题：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="title" placeholder="通知标题" value="${circular.title}"
                                               required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">通知内容：</label>
                                    <div class="am-form-group">
                                        <textarea class="am-u-sm-9 am-validate" id="content" minlength="10"
                                                  maxlength="100" name="content" placeholder="通知内容"
                                                  value="${circular.content}" required></textarea>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">发送人署名：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="signatureId" placeholder="发送人署名"
                                               value="${circular.signatureId}" required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label" for="file">附件地址：</label>
                                    <input type="file" id="file" name="file">
                                    <span class="am-u-sm-3 am-form-help">请选择要上传的文件,最大100m...</span>
                                </div>
                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <button type="submit" class="am-btn am-btn-primary">保存</button>
                                        <button type="button" class="am-btn am-btn-danger" onclick="closeModel(false)">
                                            关闭
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@ include file="../../include/bottom.jsp" %>
<script src="http://ueditor.baidu.com/ueditor/ueditor.config.js"></script>
<script src="http://ueditor.baidu.com/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var msg = '${msg}';
        if (msg != '') {
            showMsg(msg);
            closeModel(true);//关闭窗口
        }
    });

    $(function () {
        var $textArea = $('[name=content]');
        var editor = UE.getEditor('content');
        var $form = $('#ue-form');

        $form.validator({
            submit: function () {
                // 同步编辑器数据
                editor.sync();

                var formValidity = this.isFormValid();

                // 表单验证未成功，而且未成功的第一个元素为 UEEditor 时，focus 编辑器
                if (!formValidity && $form.find('.' + this.options.inValidClass).eq(0).is($textArea)) {
                    editor.focus();
                }

                console.warn('验证状态：', formValidity ? '通过' : '未通过');

                return false;
            }
        });

        // 编辑器内容变化时同步到 textarea
        editor.addListener('contentChange', function () {
            editor.sync();

            // 触发验证
            $('[name=content]').trigger('change');
        });
    });


</script>
</body>
</html>
